int func();

int main() 
{
    int result;
    __asm__ volatile (
        "jal %0, func" : "=r"(result) : : "memory"
    );
    return result;
}

int func()
{
    return 42;
}